package android.kryten.activity;

import android.app.Activity;
import android.kryten.R;
import android.kryten.service.NoteService;
import android.kryten.service.impl.NoteServiceImpl;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class AddTopicNoteActivity extends Activity{

	TextView tvNote; 
	Button btnAddNote;
	
	Long topicId;
	
	NoteService noteService = new NoteServiceImpl();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.add_topic_note);
		 
		String id = getIntent().getStringExtra("topicId");
	    topicId = Long.parseLong(id);
	    
	    btnAddNote = (Button) findViewById(R.id.btn_add_topic_note);
	   
		btnAddNote.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				
				tvNote = (TextView) findViewById(R.id.txt_note_to_add);
				
				noteService.addNote(topicId,tvNote.getText().toString());
				
			}
		});
		
	}
}
